<template>
  <div class="heard">
    <el-image style="width: 245px; height: 44px" :src="leftUrl" @click="handleHome" fit="fill" class="logo" />
  </div>
  <div style="width: 100%;box-sizing: border-box;">
    <object class="hw" type="text/x-scriptlet" :data="hwUrl" />
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { getAssetURL } from "@/utils/load_assets";
import { useRoute, useRouter } from 'vue-router';
const router = useRouter();
const route = useRoute();


const leftUrl = getAssetURL("common/logo.png");

const hwUrl = ref('');//跳转华为云链接
const isFirstLogin = ref(false);//华为云参数
const xAccountType = ref<any>('');//华为云参数
const toUrl = ref<any>('');

onMounted(() => {
  xAccountType.value = route.query.xAccountType;
  toUrl.value = route.query.toUrl;
  hwUrl.value = `https://auth.huaweicloud.com/authui/saml/login?xAccountType=${xAccountType.value}&isFirstLogin=${isFirstLogin.value}&service=` + encodeURIComponent(toUrl.value);
});

// 跳转首页
const handleHome = () => {
  router.push("/client/home");
};
</script>

<style scoped lang="less">
.heard {
  width: 100vw;
  height: 10vh;
  display: flex;
  align-items: center;

  .logo {
    cursor: pointer;
  }
}

.hw {
  width: 100%;
  height: 90vh;
}
</style>